# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=zxing-cpp
pkgver=1.1.0
pkgrel=0
arch="all"
url="https://github.com/nu-book/zxing-cpp"
pkgdesc="C++ port of ZXing"
license="Apache-2.0"
makedepends="cmake"
source="https://github.com/nu-book/zxing-cpp/archive/v$pkgver/zxing-cpp-v$pkgver.tar.gz"
subpackages="$pkgname-dev"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBRARY=ON
	cmake --build build
}

check() {
	cd build
	# ReaderTest hangs indefinitely https://github.com/nu-book/zxing-cpp/issues/149
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "ReaderTest"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="8ae6d0c2bd21de0af99c1baa470afcdd8b0375eb1d4166bb20ad67632c39ef63e1ea07b8a691cf0bc076c87d73a8d8b0ca05007c65a09bc79697aa294dc1f44f  zxing-cpp-v1.1.0.tar.gz"
